Allow SiteStatsInit to run on vslow hosts
authorSébastien Santoro <dereckson@espace-win.org>
Fri, 1 Apr 2016 11:35:40 +0000 (11:35 +0000)
committerSébastien Santoro <dereckson@espace-win.org>
Fri, 1 Apr 2016 11:35:40 +0000 (11:35 +0000)
SiteStatsInits queries could be long running, and so lead to buffers
and undo table issues.

This change allows SiteStatsInits to connect to vslow host.

Bug: T131475
Change-Id: I63c643ef3cc12f38c24374592c55364ba7569a26

includes/SiteStats.php

index 580f7cc..74c2997 100644 (file)
@@ -289,8 +289,10 @@ class SiteStatsInit {
        public function __construct( $database = false ) {
                if ( $database instanceof IDatabase ) {
                        $this->db = $database;
+               } elseif ( $database ) {
+                       $this->db = wfGetDB( DB_MASTER );
                } else {
-                       $this->db = wfGetDB( $database ? DB_MASTER : DB_SLAVE );
+                       $this->db = wfGetDB( DB_SLAVE, 'vslow' );
                }
        }